﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SheepStorage.API.Application.Command.YourTableNameCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Dto;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Controllers
{
    /// <summary>
    /// 期初管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class YourTableNameController : ControllerBase
    {
        private readonly IMediator _mediator;

        private readonly IYourTableNameService your;
        public YourTableNameController(IMediator mediator, IYourTableNameService your)
        {
            _mediator = mediator;
            this.your = your;
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<PageOutput<DawningSheepDto>>> GetYourTableName(YourTableNameShowCommand request)
        {
            return await _mediator.Send(request);
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> AddYourTableName(YourTableNameAddCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<YourTableName>> BackFillYourTableName(YourTableNamebackfillCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> UpdateYourTableName(YourTableNameUpdateCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 单删/批量删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> DeleteYourTableName(YourTableNameDeleteCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> AuditYourTableName(YourTableNameAuditCommand request)
        {
            return await _mediator.Send(request);
        }

    }
}
